package com.apes.fn.tms.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.Name;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.scm.masterdata.stock.model.PhyDepot;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;


/**
 * 功能：线路站点
 *
 * @author Linwz
 * @create 2020-03-06 9:46
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = Site.CONST_TABLE_NAME)
public class Site extends Model {
    public static final String CONST_TABLE_NAME = "tms_site";

    @Id
    @Column(name = "id", length = 10)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "线路站点")
    @Comment("编码")
    private String id;

    @Name
    @Column(name = "name", length = 30)
    @Comment("名称")
    private String name;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "phy_Depot_id", referencedColumnName = "id")
    @Comment("物理仓")
    private PhyDepot phyDepot;  //物理仓

    @Column(name = "valid", nullable = false)
    @Comment("有效")
    private boolean valid ; //有效
}
